#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

int main()
{
	int num = 0;
	while (scanf("%d", &num) != EOF)
	{
		int i = 0;
		int j = 0;
		for (int i = 0; i<num; i++)
		{
			if (i == 0 || num - 1 == i)
			{
				for (int j = 0; j<num; j++)
				{
					printf("* ");
				}
				printf("\n");
			}

			else
			{
				printf("* ");
				for (int j = 0; j<num - 2; j++)
				{
					printf("  ");
				}
				printf("*");
				printf("\n");
			}

		}
	}

	return 0;
}